package com.xzmzhp.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @author: 王源(xm)
 * @create: 2022-03-02 10:58
 * @program: ams
 * @description: web配置类
 */
@Slf4j
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {

    @Value("${imgPath}")
    private String imgPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        imgPath = imgPath.replace('\\','/');
        registry.addResourceHandler("/**")
                .addResourceLocations("file"+imgPath+"/")
                .addResourceLocations("classpath:/static/");

    }
}
